package dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import util.ConnectionUtil;

public class ClassDao {

	public static int getClassId(Object classname) {
		
        Connection conn = ConnectionUtil.getConnection();
        String sql = "SELECT classid FROM class WHERE classname LIKE '%"+classname+"%';";
        Statement stat;
        try {
        	stat = conn.createStatement();
        	ResultSet rs = stat.executeQuery(sql);
        	if(rs.next()) {
        		int classid = rs.getInt("classid");
        		return classid;
        		}
        	}catch(Exception e) {
        		e.printStackTrace();
        	}
        
		return 0;
	}

}
